﻿using System;
using System.Linq;



namespace ScriptEase
{
    /// <summary>
    /// An observable list with all local Workspace to WebResource mappings.
    /// </summary>
    public class MappingList : ObservableCollectionWithItemNotify<MappingModel>
    {
        public MappingModel GetMapping(WebResource webResource)
        {
            return base.Items.FirstOrDefault(m => string.Equals(m.WebResourceName, webResource.Name, StringComparison.InvariantCultureIgnoreCase));
        }



        public MappingModel GetMapping(string fullPath)
        {
            return base.Items.Where( item => item.FileInfo!= null).FirstOrDefault(m => string.Equals(m.FileInfo.FullName, fullPath, StringComparison.InvariantCultureIgnoreCase));
        }
    }
}